package cart
{
    import vo.Product;

    [Bindable]
    public class ShoppingCartItem
    {
        public var product:Product;
        private var _quantity:uint;
        public var subTotal:Number;
        public function ShoppingCartItem(product:Product,quantity:uint=1)
        {
            this.product = product;
            this.quantity = quantity;
            calculateSubTotal();
        }

        public function get quantity():uint
        {
            return _quantity;
        }

        public function set quantity(value:uint):void
        {
            _quantity = value;
            calculateSubTotal();
        }

        private function calculateSubTotal():void
        {
            this.subTotal = product.listPrice*quantity;
        }
        public function toString():String
        {
            return "[ShoppingCartItem] "+product.prodName+":"+quantity;
        }
    }
}